
package com.hd2tecnologia.telas;

import com.hd2tecnologia.util.DesktopPaneImagem;
import com.hd2tecnologia.telas.FornecedorTela;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

/**
 *
 * @author Dulcyelliton Silva
 */
public class PrincipalTela extends javax.swing.JFrame {

    private static PrincipalTela instance;

  
    public PrincipalTela() {
        initComponents();
        setSize(800, 700);
        this.setExtendedState(this.MAXIMIZED_BOTH);
        setLocationRelativeTo(null);
    }

    private void centralizaJanela(JInternalFrame internalFrame) {
        internalFrame.setLocation((this.getWidth() - internalFrame.getWidth()) / 2,
                (this.getHeight() - internalFrame.getHeight()) / 2);
    }

  
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        btn_CadastroCliente = new javax.swing.JButton();
        btn_CadastrarFornecedor = new javax.swing.JButton();
        btn_CadastroProduto = new javax.swing.JButton();
        btn_RegistrarVenda = new javax.swing.JButton();
        btn_ConsutarVenda = new javax.swing.JButton();
        btn_Suporte = new javax.swing.JButton();
        btn_SairSistema = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        mnuCadastros = new javax.swing.JMenu();
        mnuItemCliente = new javax.swing.JMenuItem();
        mnuItemFornecedor = new javax.swing.JMenuItem();
        mnuItemProduto = new javax.swing.JMenuItem();
        mnuVendas = new javax.swing.JMenu();
        mnuItemRegistraVenda = new javax.swing.JMenuItem();
        mnuItemConsultaVenda = new javax.swing.JMenuItem();
        mnuAjuda = new javax.swing.JMenu();
        mnuItemSobre = new javax.swing.JMenuItem();
        mnuSistema = new javax.swing.JMenu();
        mnuItemSair = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setTitle("DSControl - Sistema de Gestão de Loja");
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setResizable(false);
        getContentPane().setLayout(new java.awt.CardLayout());

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));
        jPanel1.setEnabled(false);

        jPanel2.setLayout(new java.awt.GridLayout(1, 7, 5, 10));

        btn_CadastroCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/hd2tecnologia/icones/add_32x32.png"))); // NOI18N
        btn_CadastroCliente.setText("Cadastrar Cliente");
        btn_CadastroCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_CadastroClienteActionPerformed(evt);
            }
        });
        jPanel2.add(btn_CadastroCliente);

        btn_CadastrarFornecedor.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/hd2tecnologia/icones/1335460938_Profile.png"))); // NOI18N
        btn_CadastrarFornecedor.setText("Cadastrar Fornecedor");
        jPanel2.add(btn_CadastrarFornecedor);

        btn_CadastroProduto.setIcon(new javax.swing.ImageIcon("C:\\Users\\Dulcyelliton Silva\\Desktop\\famfamfam_silk_icons_v013\\icons\\application_error.png")); // NOI18N
        btn_CadastroProduto.setText("Cadastrar Produtos");
        jPanel2.add(btn_CadastroProduto);

        btn_RegistrarVenda.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/hd2tecnologia/icones/1338524427_cart.png"))); // NOI18N
        btn_RegistrarVenda.setText("Registrar Vendas");
        jPanel2.add(btn_RegistrarVenda);

        btn_ConsutarVenda.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/hd2tecnologia/icones/1335461213_search.png"))); // NOI18N
        btn_ConsutarVenda.setText("Consultar Vendas");
        jPanel2.add(btn_ConsutarVenda);

        btn_Suporte.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/hd2tecnologia/icones/1338524468_package_settings.png"))); // NOI18N
        btn_Suporte.setText("Suporte");
        btn_Suporte.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_SuporteActionPerformed(evt);
            }
        });
        jPanel2.add(btn_Suporte);

        btn_SairSistema.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/hd2tecnologia/icones/SAIR.png"))); // NOI18N
        btn_SairSistema.setText("Sair do Sistema");
        btn_SairSistema.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_SairSistemaActionPerformed(evt);
            }
        });
        jPanel2.add(btn_SairSistema);

        jPanel3.setBackground(new java.awt.Color(255, 255, 255));
        jPanel3.setLayout(new java.awt.GridLayout());

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/hd2tecnologia/icones/fundo_principal.png"))); // NOI18N
        jPanel3.add(jLabel1);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 1210, Short.MAX_VALUE)
            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        getContentPane().add(jPanel1, "card2");

        mnuCadastros.setText("Cadastro");

        mnuItemCliente.setText("Cliente");
        mnuItemCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuItemClienteActionPerformed(evt);
            }
        });
        mnuCadastros.add(mnuItemCliente);

        mnuItemFornecedor.setText("Fornecedor");
        mnuItemFornecedor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuItemFornecedorActionPerformed(evt);
            }
        });
        mnuCadastros.add(mnuItemFornecedor);

        mnuItemProduto.setText("Produto");
        mnuItemProduto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuItemProdutoActionPerformed(evt);
            }
        });
        mnuCadastros.add(mnuItemProduto);

        jMenuBar1.add(mnuCadastros);

        mnuVendas.setText("Vendas");

        mnuItemRegistraVenda.setText("Registrar Venda");
        mnuItemRegistraVenda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuItemRegistraVendaActionPerformed(evt);
            }
        });
        mnuVendas.add(mnuItemRegistraVenda);

        mnuItemConsultaVenda.setText("Consultar Venda");
        mnuItemConsultaVenda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuItemConsultaVendaActionPerformed(evt);
            }
        });
        mnuVendas.add(mnuItemConsultaVenda);

        jMenuBar1.add(mnuVendas);

        mnuAjuda.setText("Ajuda");

        mnuItemSobre.setText("Sobre");
        mnuItemSobre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuItemSobreActionPerformed(evt);
            }
        });
        mnuAjuda.add(mnuItemSobre);

        jMenuBar1.add(mnuAjuda);

        mnuSistema.setText("Sistema");

        mnuItemSair.setText("Sair");
        mnuItemSair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuItemSairActionPerformed(evt);
            }
        });
        mnuSistema.add(mnuItemSair);

        jMenuBar1.add(mnuSistema);

        setJMenuBar(jMenuBar1);

        pack();
        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        java.awt.Dimension dialogSize = getSize();
        setLocation((screenSize.width-dialogSize.width)/2,(screenSize.height-dialogSize.height)/2);
    }// </editor-fold>//GEN-END:initComponents

    private void mnuItemSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuItemSairActionPerformed
        kilInstance();
        this.dispose();
    }//GEN-LAST:event_mnuItemSairActionPerformed

    private void mnuItemSobreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuItemSobreActionPerformed
        JOptionPane.showMessageDialog(this, "HD2 Tecnologia - Soluções de Qualidade!", "Informação", JOptionPane.INFORMATION_MESSAGE);
    }//GEN-LAST:event_mnuItemSobreActionPerformed

    private void mnuItemClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuItemClienteActionPerformed
        ClienteTela cliente = ClienteTela.getInstance();
        cliente.setVisible(true);
    }//GEN-LAST:event_mnuItemClienteActionPerformed

    private void mnuItemFornecedorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuItemFornecedorActionPerformed
        
    }//GEN-LAST:event_mnuItemFornecedorActionPerformed

    private void mnuItemProdutoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuItemProdutoActionPerformed
        
    }//GEN-LAST:event_mnuItemProdutoActionPerformed

    private void mnuItemRegistraVendaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuItemRegistraVendaActionPerformed
      
    }//GEN-LAST:event_mnuItemRegistraVendaActionPerformed

    private void mnuItemConsultaVendaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuItemConsultaVendaActionPerformed
        
    }//GEN-LAST:event_mnuItemConsultaVendaActionPerformed

    private void btn_CadastroClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_CadastroClienteActionPerformed
       ClienteTela clienteTela = ClienteTela.getInstance();
       clienteTela.setVisible(true);
    }//GEN-LAST:event_btn_CadastroClienteActionPerformed

    private void btn_SairSistemaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_SairSistemaActionPerformed
        kilInstance();
        this.dispose();
    }//GEN-LAST:event_btn_SairSistemaActionPerformed

    private void btn_SuporteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_SuporteActionPerformed
          JOptionPane.showMessageDialog(this, "HD2 Tecnologia - Soluções de Qualidade!", "Informação", JOptionPane.INFORMATION_MESSAGE);
    }//GEN-LAST:event_btn_SuporteActionPerformed

    
  
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btn_CadastrarFornecedor;
    private javax.swing.JButton btn_CadastroCliente;
    private javax.swing.JButton btn_CadastroProduto;
    private javax.swing.JButton btn_ConsutarVenda;
    private javax.swing.JButton btn_RegistrarVenda;
    private javax.swing.JButton btn_SairSistema;
    private javax.swing.JButton btn_Suporte;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JMenu mnuAjuda;
    private javax.swing.JMenu mnuCadastros;
    private javax.swing.JMenuItem mnuItemCliente;
    private javax.swing.JMenuItem mnuItemConsultaVenda;
    private javax.swing.JMenuItem mnuItemFornecedor;
    private javax.swing.JMenuItem mnuItemProduto;
    private javax.swing.JMenuItem mnuItemRegistraVenda;
    private javax.swing.JMenuItem mnuItemSair;
    private javax.swing.JMenuItem mnuItemSobre;
    private javax.swing.JMenu mnuSistema;
    private javax.swing.JMenu mnuVendas;
    // End of variables declaration//GEN-END:variables

    public PrincipalTela getInstance(){
        if(instance==null){
            instance = new PrincipalTela();
        }
        return instance;
    }
    
    public void kilInstance(){
        instance = null;
    }
}
